
Imports System
Imports System.Collections
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports _2bMatesSite.BO

Namespace _2bMatesSite
	''' <summary>
	''' Summary description for my_profile.
	''' </summary>
	Public Partial Class my_profile
		Inherits BaseWebPage

		Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
			' Put user code to initialize the page here
			' this.pageTemplate.PageTitle = PageTitles.JOIN_PAGE;
			litTitle.Text = "Summary"

			Dim user As User = LoggedUser
			If user = Nothing Then
				Common.Utils.RedirectToLoginPage(Page)
			End If

			litRightLinks.Text = "&nbsp;"
			litTitle.Text = "My Profile"

			txtAboutMe.Attributes.Add("onKeyDown", Constants.ON_KEY_DOWN_SCRIPT.Replace(Constants.TEXT_AREA_MAX_CHARS_TAG, Constants.TEXT_AREA_ABOUT_ME_MAX_CHARS.ToString()))
			txtAboutMe.Attributes.Add("onKeyUp", Constants.ON_KEY_UP_SCRIPT.Replace(Constants.TEXT_AREA_MAX_CHARS_TAG, Constants.TEXT_AREA_ABOUT_ME_MAX_CHARS.ToString()))

			txtLookingFor.Attributes.Add("onKeyDown", Constants.ON_KEY_DOWN_SCRIPT.Replace(Constants.TEXT_AREA_MAX_CHARS_TAG, Constants.TEXT_AREA_LOOKING_FOR_MAX_CHARS.ToString()))
			txtLookingFor.Attributes.Add("onKeyUp", Constants.ON_KEY_UP_SCRIPT.Replace(Constants.TEXT_AREA_MAX_CHARS_TAG, Constants.TEXT_AREA_LOOKING_FOR_MAX_CHARS.ToString()))

			txtInterests.Attributes.Add("onKeyDown", Constants.ON_KEY_DOWN_SCRIPT.Replace(Constants.TEXT_AREA_MAX_CHARS_TAG, Constants.TEXT_AREA_INTERESTS_MAX_CHARS.ToString()))
			txtInterests.Attributes.Add("onKeyUp", Constants.ON_KEY_UP_SCRIPT.Replace(Constants.TEXT_AREA_MAX_CHARS_TAG, Constants.TEXT_AREA_INTERESTS_MAX_CHARS.ToString()))
		End Sub

		Private Sub InitUser(ByVal user As User)
			Dim temp As String = ""

			user.MaritalStatus = Convert.ToInt32(Request.Params(rbSDS.NamingContainer.UniqueID + ":" + rbSDS.GroupName))

			temp = Request.Params(txtAboutMe.UniqueID).Trim()
			user.AboutMe = temp.Substring(0, Math.Min(temp.Length, Constants.TEXT_AREA_ABOUT_ME_MAX_CHARS))

			temp = Request.Params(txtLookingFor.UniqueID).Trim()
			user.LookingFor = temp.Substring(0, Math.Min(temp.Length, Constants.TEXT_AREA_LOOKING_FOR_MAX_CHARS))

			temp = Request.Params(txtInterests.UniqueID).Trim()
			user.Interests = temp.Substring(0, Math.Min(temp.Length, Constants.TEXT_AREA_INTERESTS_MAX_CHARS))

			user.EditDate = DateTime.Now

			user.Save()
		End Sub

		#region Web Form Designer generated code
		Protected Overloads Overrides Sub OnInit(ByVal e As EventArgs)
			'
			' CODEGEN: This call is required by the ASP.NET Web Form Designer.
			'
			InitializeComponent()
			MyBase.OnInit(e)
		End Sub

		''' <summary>
		''' Required method for Designer support - do not modify
		''' the contents of this method with the code editor.
		''' </summary>
		Private Sub InitializeComponent()

		End Sub
#End Region

		Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			If Me.IsValid Then
				InitUser(LoggedUser)
				Response.Redirect(Constants.UPLOAD_PHOTO + "?" + Constants.REGISTRATION_PARAM + "=" + Constants.REGISTRATION_VALUE)
			End If
		End Sub

		Protected Sub btnSkip_Click(ByVal sender As Object, ByVal e As System.EventArgs)
			Response.Redirect(Constants.UPLOAD_PHOTO + "?" + Constants.REGISTRATION_PARAM + "=" + Constants.REGISTRATION_VALUE)
		End Sub
	End Class
End Namespace






